
/**
 * created on 2012-05-20
 * @author  qiujz
 * @version 1.0
 *
 * Copyright (c)  Founder Software (Suzhou) Co., Ltd.  2012
 *  All rights reserved.
 *
 * 
 * ================================================================
 * Change Revision
 * ---------------------------------------------------------------
 *    DATE                BY                   COMMENT
 * ---------------------------------------------------------------
 * 2012-05-20         qiujz                Create class
 * 
 *
 * ================================================================
 */
package com.qjz.controller
{
	import com.founder.framework.base.BaseController;
	import com.founder.framework.base.BaseModel;
	import com.founder.framework.common.FounderUtils;
	import com.founder.framework.interfaces.IControllerable;
	import com.qjz.common.CommonUtils;
	import com.qjz.entity.FunctionOpenQueryParameter;
	import com.qjz.model.FunctionOpenModel;
	
	import mx.collections.ArrayCollection;
	import mx.core.FlexGlobals;
	import mx.rpc.AsyncResponder;
	import mx.rpc.AsyncToken;
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.remoting.RemoteObject;
	
	/**
	 * 页面控制器对象
	 * @author qiujz
	 */
	public class FunctionOpenController extends BaseController implements IControllerable
	{
		/**
		 * 构造函数
		 * @param model
		 */
		public function FunctionOpenController(model:FunctionOpenModel)
		{
			super(model);

			_service=new RemoteObject();
			_service.destination="sims.functionOpenService";
			_service.endpoint=CommonUtils.getServer(CommonUtils.SIMS);
			_service.showBusyCursor=true;
		}

		/**
		 * 获取页面模型对象
		 * @return 模型对象 
		 */
		public function get model():FunctionOpenModel
		{
			return _model as FunctionOpenModel;
		}

	
		/**
		 * 取得远程对象查询实体的方法
		 * @return 远程对象查询实体的接口方法
		 */
		public function get getEntityOperation():Object
		{
			return _service.getFunctionOpenByPrimaryKey;
		}

		/**
		 * 取得远程对象检索实体的方法
		 * @return 远程对象检索实体的接口方法
		 */
		public function get searchOperation():Object
		{
			return _service.searchFunctionOpenList;
		}

		/**
		 * 取得远程对象新增实体的方法
		 * @return 远程对象新增实体的接口方法
		 */
		public function get insertOperation():Object
		{
			return _service.insertFunctionOpen;
		}

		/**
		 * 取得远程对象修改实体的方法
		 * @return 远程对象修改实体的接口方法
		 */
		public function get modifyOperation():Object
		{
			return _service.updateFunctionOpen;
		}

		/**
		 * 取得远程对象删除实体的方法
		 * @return 远程对象删除实体的接口方法
		 */
		public function get deleteOperation():Object
		{
			return _service.deleteFunctionOpen;
		}

		/**
		 * 取得远程对象批量删除实体的方法
		 * @return 远程对象批量删除实体的接口方法
		 */
		public function get deleteBatchOperation():Object
		{
			return _service.deleteFunctionOpenBatch;
		}
		
		public function doSubmit(list:ArrayCollection):AsyncToken
		{
			var token:AsyncToken=_service.submitFuncOpen.send(list);
			token.addResponder(new AsyncResponder(doSubmitHandler, faultHandler, token));
			return token;
		}		
		private function doSubmitHandler(event:ResultEvent, token:AsyncToken=null):void
		{
			FounderUtils.alert("操作成功！", "成功", null, null, FounderUtils.successIcon);
		}
	}
}
